/*
 * Score.java
 *
 * This program demonstrates the use of Arithmetic, Relational, Conditional
 * and Logical Operators to calculate the scores for giving scholarship.
 *
 * 
 */

package com.javacore.day3.studentscore;

import java.util.Scanner;

/**
 *
 * @author
 */

public class Score {
    
    /** Creates a new instance of Score */
    public Score() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // Declare variables to store marks of Kevin
        int kMaths, kScience, kEnglish;
        
        // Declare variables to store marks of Dona
        int dMaths, dScience, dEnglish;
        
        // Declare variables to store the total marks of both
        int kSum = 0;
        int dSum = 0;
        
        // Declare variables to store percentage of marks scored by Kevin
        // and Dona
        int kPercent = 0;
        int dPercent = 0;
        
        // Accept marks of Kevin
        Scanner input = new Scanner(System.in);
        System.out.println("\nEnter marks obtained in Maths: ");
        kMaths = input.nextInt();
        System.out.println("Enter marks obtained in Science: ");
        kScience = input.nextInt();
        System.out.println("Enter marks obtained in English: ");
        kEnglish = input.nextInt();
        
        // Accept marks of Dona
        System.out.println("\nEnter marks obtained in Maths: ");
        dMaths = input.nextInt();
        System.out.println("Enter marks obtained in Science: ");
        dScience = input.nextInt();
        System.out.println("Enter marks obtained in English: ");
        dEnglish = input.nextInt();
        
        // Display marks of Kevin
        System.out.println("\nMarks of Kevin:");
        System.out.println("Maths = " +kMaths);
        System.out.println("Science = " +kScience);
        System.out.println("English = " +kEnglish);
        
        // Display marks of Dona
        System.out.println("\nMarks of Dona:");
        System.out.println("Maths = " +dMaths);
        System.out.println("Science = " +dScience);
        System.out.println("English = " +dEnglish);
        
        // Calculate total marks scored by both
        kSum = kMaths + kScience + kEnglish;
        dSum = dMaths + dScience + dEnglish;
        
        // Calculate percentage scored by both
        kPercent = kSum * 100 / 300;
        dPercent = dSum * 100 / 300;
        
        // Display the total marks and percentage scored by Kevin
        System.out.println("\nTotal marks scored by Kevin = " + kSum);
        System.out.println("Percentage = " + kPercent + "%");
        
        System.out.println("\nTotal marks scored by Dona = " + dSum);
        System.out.println("Percentage = " + dPercent + "%");
        
        // Compare the percentages of both
        System.out.print("\nIs Kevin's percentage lesser than Dona? ");
        System.out.println(kPercent < dPercent ? "Yes" : "No");
        
        System.out.print("Is Kevin's percentage greater than Dona? ");
        System.out.println(kPercent > dPercent ? "Yes" : "No");
        
        System.out.print("Kevin's and Dona's percentage are equal? ");
        System.out.println(kPercent == dPercent ? "Yes" : "No");
                
        // Scholarship Amount to be given to Kevin and Dona
        System.out.print("\nScholarship Amount for Kevin = $");
        System.out.println(kPercent > 75 ? 20000 : (kPercent >= 60 && kPercent <=75) ? 10000 : 0);
        System.out.print("Scholarship Amount for Dona = $");
        System.out.println(dPercent > 75 ? 20000 : (dPercent >= 60 && dPercent <=75) ? 10000 : 0);
        
    }
    
}
